package demo3;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

public class clone1{

    public static void main(String[] args) throws CloneNotSupportedException {
        User u1 = new User("杨通通", 13);
        User u2 = (User) u1.clone();
        System.out.println(u2);

    }


}

@Data
@AllArgsConstructor
@NoArgsConstructor
class User implements Cloneable{
    private String name;
    private Integer age;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
